<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>video</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link type="text/css" rel="stylesheet" href="../../css/pepper-grinder/jquery-ui-1.8.16.custom.css" />
	<link type="text/css" rel="stylesheet" href="css/cartoon.css" />
	<link type="text/css" rel="stylesheet" href="../../css/jRating.jquery.css" />
	<link type="text/css" rel="stylesheet" href="../../css/popeWin.css" />
	<script type="text/javascript" src="../../js/jquery.min.js"></script>
	<script type="text/javascript" src="../../js/jquery-ui-1.8.16.custom.min.js"></script>
	<script type="text/javascript" src="../../js/jquery.mousewheel.min.js"></script>
	<script type="text/javascript" src="../../js/jRating.jquery.js"></script>
	<script type="text/javascript" src="../../js/popeScroll.js"></script>
	<script type="text/javascript" src="../../js/popeWin.js"></script>
	<script language="JavaScript" type="text/JavaScript">
		var id;
		$(document).ready(function() {
			var cururl = window.location.href;
			id = cururl.split('=')[1];
			$(window).resize(function() {
				refresh();
			});
			
			$.getJSON("video_getVideoById.do",{id:id},function(json){			
				$.get("rating_getRatingAVG.do",{objid:id},function(data){
					var ratingnum = parseInt(data);
					var divstr = '<div style="width:100%;float:left;">';
					   divstr += '<div class="imgdiv" style="padding-left:2%;padding-top:2%;width:10%;float:left;">';
					   divstr += '<img id="'+json.id+'" src="'+json.ver_big_pic+'" style="width:100%;border:#f8f7f0 2px solid;"/>';
					   divstr += '</div>';
					   divstr += '<div style="float:left;padding-top:2%;padding-left:2%;width:60%;line-height: 23px;">';
					   divstr += '<div style="float:left;">'+json.tv_name+'</div>';
					   divstr += '<div id="'+ratingnum+'_'+id+'" class="rating" style="width:100%;float:left;"></div>';
					   divstr += '<div style="float:left;">'+data+'</div>';
					   divstr += '<div style="float:left;"><img id="comment_img" onclick="showComment(\''+id+'\');" src="../../image/icon2/ichat.png" title="评论" style="width:23px;height:23px;cursor:pointer;" /></div>';
					   divstr += '<div style="float:left;"><img id="collection_img" onclick="addCollection(\''+id+'\',3,\''+json.tv_name+'\',\''+json.tv_desc+'\');" src="../../image/icon2/star.png" title="收藏" style="width:23px;height:23px;cursor:pointer;" /></div>';
					   divstr += '<div id="collection_msg" style="float:left;width:120px;display:none;"><span style="width:100px;height:23px;margin-left:20px;color:red;font-size:14px;"></span></div>';
					   divstr += '</div>';
					   divstr += '<div style="float:left;padding-top:1%;padding-left:2%;width:60%;">'+"年份："+json.tv_year+'</div>';
					   divstr += '<div style="float:left;padding-top:1%;padding-left:2%;width:60%;">'+"主演："+json.main_actor+'</div>';
					   divstr += '<div style="float:left;padding-top:1%;padding-left:2%;width:60%;">'+"导演："+json.director+'</div>';
					   divstr += '<div id="content" style="float:left;padding-top:1%;padding-left:2%;width:60%;">'+"简介："+json.tv_desc+'</div>';
					   divstr += '</div>';
					   divstr += '</div>';
					$("#info").append(divstr);
					refresh();
					$.getJSON("rating_getUserRating.do",{objid:id},function(json){				
						if(json == null){
							$(".rating").jRating({
								bigStarsPath : "../../image/rating/stars.png" 
							});
						}else{
							$(".rating").jRating({
								bigStarsPath : "../../image/rating/stars.png",
								isDisabled:true
							});
						}
					});
				});

			});
			$.getJSON("video_getVideoItemListById.do",{id:id},function(json){
				var htmlstr = "";
				for(var i=0;i<json.length;i++){
					var name = json[i].tv_name;
					if(name.length>16){
						name = name.substring(0,16)+"...";
					}
					htmlstr += '<div id="chapter'+ json[i].id +'" style="width: 10%;padding-left: 2%;float: left; ">';
					htmlstr += '<div style="padding-left: 1%;padding-top: 1%;"><img id="img_'+ json[i].id +'" onclick="playVideo(this);" class="imgs" src="'+ json[i].video_big_pic +'" style="width:100%;cursor: pointer;" /></div>';
					htmlstr += '<div id="video_'+ json[i].id +'" class="video_name" onclick="playVideo(this);" style="text-align: center;padding-left: 1%;padding-top: 1%;cursor: pointer;"><span style="font-size: 12px;color: #fff;">'+ name +'</span></div>';
					htmlstr += '</div>';
				}	
				$("#chapters").append(htmlstr);
				refresh();
			});
			
			$("#toolcontent").hover(function(){
				$(this).removeClass("transparent_0");
				$(this).addClass("transparent_class");
			},function(){
				$(this).removeClass("transparent_class");
				$(this).addClass("transparent_0");
			});
			$("#chapters").popeScroll({
				mousewheelBox:"box",
				offset_top:-180,
				top:45
			});
			refresh();
		});
		
		function showComment(objid){
			var winheight = $(window).height();
			var winwidth = $(window).width();
			
			var showstate = $("#miniWin_comment_img").css("display");
			if(showstate==null||showstate=="none"){
				$.popeWinMini({
					id:"comment_img",
					width:winwidth*0.5,
					height:winheight*0.8,
					url:"../comment/main.html?id="+id
				});
			}else{
				$.popeWinMiniClose({
					id:"comment_img"
				});
			}
		}
		
		function addCollection(objid,type,title,desc){
			$.get("personcollection_addCollection.do",{objid:objid,type:type,title:title,desc:desc},function(data){
				if(data=="success"){
					$("#collection_msg span").text("添加收藏成功");
					$("#collection_msg").show();
					setTimeout(function(){
						$("#collection_msg span").empty();
						$("#collection_msg").hide();
					},3000);
				}else{
					$("#collection_msg span").text("添加收藏失败");
					$("#collection_msg").show();
					setTimeout(function(){
						$("#collection_msg span").empty();
						$("#collection_msg").hide();
					},3000);
				}
			});
		}
		
		function playVideo(obj){
			var videoItemId = obj.id.split("_")[1];
			$.getJSON("video_getVideoItemByItemId.do",{videoItemId:videoItemId},function(json){
				if(json == null){
					return;
				}
				window.parent.resizeWin("cartoon1",null,null,900,740);
				window.location.href = "playCartoon.html?id="+videoItemId+"&videoId="+id;
			});	
		}
		
		function goback(){
			window.parent.resizeWin("cartoon1",0.5,0.8);
			window.location.href = "main.html";
		}


		function refresh(){
			var winheight = $(window).height();
			var winwidth = $(window).width();
			$("#bodydiv").css("height",winheight);
			$("#line").css("height",winheight*0.02);
			$("#list").css("height",winheight*0.60);
			$("#content").css("width",winwidth*0.75);
			$(".imgss").css("height",winwidth*0.10*1.375);
		}
		
	</script>
</head>
<body style="background-color=transparent;width:100%;margin-left:0px;margin-top:0px;">
	<div id="bodydiv" style="background:url(../../image/bg/7.png)">
		<div id="info" style="width:100%;float:left;"></div>
		<div id="line" style="width:100%;border-bottom:#f8f7f0 2px solid;float:left;"></div>
		<div id="contentDiv" style="width:100%;float:left;">
			<div style="width:100%;float:left;padding-left:2%;padding-top:1%;">动漫列表</div>
			<div id="list" style="width:100%;float:left;padding-left:2%;padding-top:1%;overflow:hidden;">
				<div id="box" style="overflow:hidden;width:99%;float:left;margin-left:1%;">
					<div id="chapters" style="float:left;width:100%;"></div>
				</div>
			</div>
		</div>
		<div id="toolcontent" class="toolcontent transparent_0">
			<div style="height:100%;">
				<img title="返回" src="../../image/cover/system/white/MB_0006_back.png" style="width:60px;height:60px;cursor:pointer;float:right;padding-right:10px;" onclick="goback();" /> 
			</div>
		</div>
	</div>
</body>
</html>